const { updateLabel } = require("typescript");

// ul.addEventLisenter('click',fn)
function addEventLisenter(element, eventName, fn) {
  if (element.addEventListener) {
      element.addEventListener(eventName, fn);
  } else {
      element.attachEvent('on'+ eventName, fn);
  } else {
      element['on'+ eventName] = fn; //.onclick 传统无兼容性问题
  }
}

const addEventLisenter = (ele,eleName,fn) => {
  if (ele.addEventLisenter) {
    ele.addEventLisenter(eleName,fn)
  } else {
    ele.attachEvent('on' + eleName, fn)
  } else {
    ele['on'+eleName] = fn
  }
}

// 解绑事件
.onclick = null;
removeEventListener
//fn在外面写，fn的里面写一句removeEventListener就可以了
detachEvent